﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;

using Weazel.Gezel.Parser;

namespace Weazel.Willows.PreliminaryModel
{
	public static class ExpressionReader
	{
		public static Weazel.Gezel.Model.Expression Read(XmlElement description)
		{
			System.Diagnostics.Debug.Assert(description.Name == "Expression");
			System.Diagnostics.Debug.Assert(description.InnerText != null);

			Tokenizer t = new Tokenizer(description.InnerText.Trim());
			Weazel.Gezel.Model.Expression expression =
				ParseSemicolonExpression.Parse(new Set<Token>(Token.Eof), t);

			System.Diagnostics.Debug.Assert(expression != null);

			return expression;
		}
	}
}
